<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;

class IndexController extends Controller
{

    public function index()
    {
        return view('admin.index.index');
    }


    public function welcome()
    {
        return view('admin.index.welcome');
    }


    public function login()
    {
        return view('admin.index.login');
    }


    public function test()
    {
        Redis::set('name', 'lisi');
        Redis::expire('name', 1000); 	// 设置过期时间
    }

    public function test2()
    {
        dd(Redis::get('name'));
    }

    public function testRedis()
    {
        Cache::add('name','zhansan', 10);
    }


    public function getCache()
    {
        dump(Cache::get('name'));
//        dump(session('_token'));
    }

    public function jiami()
    {
        dump(password_hash('123456', PASSWORD_BCRYPT));
    }

    public function verifyPassword(Request $request)
    {
        $password  = $request->input('password', '123456');

        dump(password_verify($password, '$2y$10$gxR/GdMgJKe0ApWQRlglsuVf5KCEltBHhAC9En2uugRCay.a6QKr6'));

    }


    public function laravelPassword()
    {
        dd(\Hash::make('123456'));
    }

    public function laravelVerify(Request $request)
    {
        $password  = $request->input('password', '123456');
        dd(\Hash::check($password, '$2y$10$wXksE.ewJlFzniqAOcasKe1vtQt2L1kMtp/S7BnEXT3QdbCpKCzku'));
    }

}
